home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / cmds.fmt / sort.man < prev    next >
Encoding:
Text File  |  1989-03-03  |  4.6 KB  |  199 lines

  1.  
  2.  
  3.  
  4. SORT                      User Commands                      SORT
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      sort - sort or merge files
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ssoorrtt [ -_m_u_b_d_f_i_n_r_t_x ] [ ++_p_o_s_1  [ --_p_o_s_2 ] ] ...  [ --oo name ] [
  13.      --TT directory ] [ name ] ...
  14.  
  15. DDEESSCCRRIIPPTTIIOONN
  16.      _S_o_r_t sorts lines of all the named files together and writes
  17.      the result on the standard output.  The name `-' means the
  18.      standard input.  If no input files are named, the standard
  19.      input is sorted.
  20.  
  21.      The default sort key is an entire line.  Default ordering is
  22.      lexicographic by bytes in machine collating sequence.  The
  23.      ordering is affected globally by the following options, one
  24.      or more of which may appear.
  25.  
  26.      bb    Ignore leading blanks (spaces and tabs) in field com-
  27.           parisons.
  28.  
  29.      dd    `Dictionary' order: only letters, digits and blanks are
  30.           significant in comparisons.
  31.  
  32.      ff    Fold upper case letters onto lower case.
  33.  
  34.      ii    Ignore characters outside the ASCII range 040-0176 in
  35.           nonnumeric comparisons.
  36.  
  37.      nn    An initial numeric string, consisting of optional
  38.           blanks, optional minus sign, and zero or more digits
  39.           with optional decimal point, is sorted by arithmetic
  40.           value.  (Note that --00 is considered equal to 00.) Option
  41.           nn implies option bb..
  42.  
  43.      rr    Reverse the sense of comparisons.
  44.  
  45.      tt_x   `Tab character' separating fields is _x.
  46.  
  47.      The notation ++_p_o_s_1 --_p_o_s_2 restricts a sort key to a field
  48.      beginning at _p_o_s_1 and ending just before _p_o_s_2.  _P_o_s_1 and
  49.      _p_o_s_2 each have the form _m.._n, optionally followed by one or
  50.      more of the flags bbddffiinnrr,, where _m tells a number of fields
  51.      to skip from the beginning of the line and _n tells a number
  52.      of characters to skip further.  If any flags are present
  53.      they override all the global ordering options for this key.
  54.      If the bb option is in effect _n is counted from the first
  55.      nonblank in the field; bb is attached independently to _p_o_s_2.
  56.      A missing .._n means .0; a missing --_p_o_s_2 means the end of the
  57.      line.  Under the --tt_x option, fields are strings separated by
  58.      _x; otherwise fields are nonempty nonblank strings separated
  59.      by blanks.
  60.  
  61.  
  62.  
  63. Sprite v1.0            September 30, 1987                       1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SORT                      User Commands                      SORT
  71.  
  72.  
  73.  
  74.      When there are multiple sort keys, later keys are compared
  75.      only after all earlier keys compare equal.  Lines that oth-
  76.      erwise compare equal are ordered with all bytes significant.
  77.  
  78.      These option arguments are also understood:
  79.  
  80.      cc    Check that the input file is sorted according to the
  81.           ordering rules; give no output unless the file is out
  82.           of sort.
  83.  
  84.      mm    Merge only, the input files are already sorted.
  85.  
  86.      oo    The next argument is the name of an output file to use
  87.           instead of the standard output.  This file may be the
  88.           same as one of the inputs.
  89.  
  90.      TT    The next argument is the name of a directory in which
  91.           temporary files should be made.
  92.  
  93.      uu    Suppress all but one in each set of equal lines.
  94.           Ignored bytes and bytes outside keys do not participate
  95.           in this comparison.
  96.  
  97. EEXXAAMMPPLLEESS
  98.      Print in alphabetical order all the unique spellings in a
  99.      list of words.  Capitalized words differ from uncapitalized.
  100.  
  101.              sort -u +0f +0 list
  102.  
  103.      Print the password file (_p_a_s_s_w_d(5)) sorted by user id number
  104.      (the 3rd colon-separated field).
  105.  
  106.              sort -t: +2n /etc/passwd
  107.  
  108.      Print the first instance of each month in an already sorted
  109.      file of (month day) entries.  The options --uumm with just one
  110.      input file make the choice of a unique representative from a
  111.      set of equal lines predictable.
  112.  
  113.              sort -um +0 -1 dates
  114.  
  115. FFIILLEESS
  116.      /usr/tmp/stm*, /tmp/*    first and second tries for tem-
  117.      porary files
  118.  
  119. SSEEEE AALLSSOO
  120.      uniq(1), comm(1), rev(1), join(1)
  121.  
  122. DDIIAAGGNNOOSSTTIICCSS
  123.      Comments and exits with nonzero status for various trouble
  124.      conditions and for disorder discovered under option --cc.
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0            September 30, 1987                       2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SORT                      User Commands                      SORT
  137.  
  138.  
  139.  
  140. BBUUGGSS
  141.      Very long lines are silently truncated.
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0            September 30, 1987                       3
  196.  
  197.  
  198.  
  199.